package com.chen.module.testproducerconsumer;

import java.util.ArrayList;
import java.util.List;

/**
 * create by chen on 2020/4/14 11:24
 * Email:chenshaopeng90@hotmail.com
 */
public class TestList {

    public static void main(String[] args) {
        List<String> list1 = new ArrayList<>();
        list1.add("A");
        list1.add("B");
        list1.add("C");
        list1.add("D");

        List<String> list2 = new ArrayList<>();
        list1.add("A2");
        list1.add("B2");
        list1.add("C2");
        list1.add("D2");
        System.out.println(System.identityHashCode(list1));
        System.out.println(System.identityHashCode(list2));

//        list1 = list2;
//        System.out.println("------------after list1 = list2-------------");
        System.out.println("------------after list1.addAll-------------");
        list1.clear();
        list1.addAll(list2);
        System.out.println(System.identityHashCode(list1));

    }
}